import request from '@/utils/request'

export function userManage(url,method, data) {
  return request({
    url: '/api/user' + url,
    method: method || 'post',
    data
  })
}

export function roleManage(url, method, params, type) {
  if (type == 1) {
    return request({
      url: '/api/role' + url,
      method: method,
      data: params
    })
  } else {
    return request({
      url: '/api/role' + url,
      method: method,
      params
    })
  }
}
export function authority(url, data) {
  return request({
    url: '/api/authority' + url,
    method: 'post',
    data
  })
}
export function enumsAll(url, method, params, type) {
  if (type == 1) {
    return request({
      url: '/api/enum' + url,
      method: method,
      data: params
    })
  } else {
    return request({
      url: '/api/enum' + url,
      method: method,
      params
    })
  }
}
export function operates(url, method, params, type) {
  if (type == 1) {
    return request({
      url: '/api/system' + url,
      method: method,
      data: params
    })
  } else {
    return request({
      url: '/api/system' + url,
      method: method,
      params
    })
  }
}
export function stats(url, method, params, type) {
  if (type == 1) {
    return request({
      url: '/api/stats' + url,
      method: method,
      data: params
    })
  } else {
    return request({
      url: '/api/stats' + url,
      method: method,
      params
    })
  }
}
// 文件下载
export function downloadFile(url) {
  return request({
    url: url,
    method: 'get',
    responseType: 'blob',
  })
}
export function tags(url, method, params, type) {
  if (type == 1) {
    return request({
      url: '/api/tag' + url,
      method: method || 'post',
      data: params
    })
  } else {
    return request({
      url: '/api/tag' + url,
      method: method || 'post',
      params
    })
  }
}